﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using AttributeRouting;
using AttributeRouting.Web.Mvc;
using Phatent.Model.Functions;
using Phatent.Logic.Functions;
using Phatent.Model.Pages;
using Phatent.Logic.Pages;
namespace Phatent.Website.Areas.Home.Controllers
{
    [RouteArea("Home")]
    [RoutePrefix("Function")]
    public class FunctionController : Controller
    {
        [Route("Meeting")]
        public ActionResult Meeting()
        {
            return View();
        }

        [Route("SearchEmployee")]
        public ActionResult SearchEmployee()
        {
            return View();
        }

        [Route("ShowEmployee/{guid:guid}")]
        public ActionResult ShowEmployee(Guid guid)
        {
            if (guid!=Guid.Empty)
            {
                var model = EmployeeLogic.GetModel(guid);
                if (model != null)
                {
                    if (model.Status == 1)
                    {
                        EmployeeLogic.Expired(guid);
                        var page = PageLogic.GetPage(43, model.EmployeeName);
                        if (page != null)
                        {
                            //var cas = CaseLogic.GetCaseByID(43);
                            //ViewBag.Case = cas;
                            //return View("/Areas/Home/Views/General/Article.cshtml",page);
                            return Redirect(string.Format("/Home/Article/{0}", page.ID));
                        }
                    }
                }
            }
            throw new HttpException(404, "这个页面已过期!");
        }
    }
}
